package com.admin.servlet;

import com.admin.bean.Advert;
import com.admin.bean.Discuss;
import com.admin.dao.advertDao;
import com.admin.dao.discussDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;


public class advertSearchServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        HttpSession session=request.getSession();
        List<Advert> adverts= new advertDao().selectadvert();
        System.out.println(adverts.size());
        session.setAttribute("adverts",adverts);
        response.sendRedirect(request.getContextPath()+"/admin/list_Advert.jsp");
    }
}
